<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>krpano-editor</title>
    <% if (htmlWebpackPlugin.options.nodeModules) { %>
      <!-- Add `node_modules/` to global paths so `require` works properly in development -->
      <script>
        require('module').globalPaths.push('<%= htmlWebpackPlugin.options.nodeModules.replace(/\\/g, '\\\\') %>')
      </script>
    <% } %>
  </head>
  <body>
    <button onclick="openPano()">打开本地全景</button>
    <script>
      const dialog = require('electron').remote.dialog
      const { ipcRenderer } = require('electron')

      function openPano() {
        dialog.showOpenDialog({}, (filePaths, bookmarks) => {
          if (filePaths !== undefined && filePaths !== '' && !!filePaths.length) {
            console.log(filePaths[0])
            ipcRenderer.send('localPanoPath', filePaths[0])
          }
        })
      }

    </script>

    <div id="app"></div>
    <script>
      if (process.env.NODE_ENV !== 'development') window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
      console.log(`process: ${process.env.NODE_ENV}`)
    </script>
  </body>
</html>
